package com.open.capacity.forum.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.open.capacity.common.exception.service.ServiceException;
import com.open.capacity.common.web.PageResult;
import com.open.capacity.common.web.Result;
import com.open.capacity.forum.model.Article;
import com.open.capacity.forum.model.ArticleCategory;
import com.open.capacity.forum.model.ArticleCategoryRelation;

import java.util.List;
import java.util.Map;

public interface ArticleService extends IService<Article> {

    /**
     * 删除文章（且移除文章所属的分类专栏）
     * @param articleId 文章id
     * @return result
     * @throws ServiceException
     */
    Result deleteArticleById(Long articleId) throws ServiceException;

    /**
     * 根据文章编号移除文章所拥有的分类专栏
     * @param articleId 文章id
     * @param ids 分类专栏id
     * @return result
     */
    Result removeArticleCategory(Integer articleId, Integer[] ids) throws ServiceException;

    /**
     * 文章分页条件查询
     * @param params 查询参数（含分页参数）
     * @return 分页数据
     */
    PageResult findArticlePage(Map<String, Object> params) throws ServiceException;

    /**
     * 新创建分类专栏到指定文章
     * @param articleId
     * @param articleCategories
     * @return
     */
    Result createdCategiryToArticle(Integer articleId, List<ArticleCategory> articleCategories) throws ServiceException;


    /**
     * 追加分类专栏到指定文章
     * @param categoryRelations 文章分类专栏关系实体
     * @return
     * @throws ServiceException
     */
    Result appendCategoryToArticle(List<ArticleCategoryRelation> categoryRelations) throws ServiceException;

    PageResult findBlogPage(Map<String, Object> params) throws ServiceException;
}
